package com.jumper.cwolf.leetcode;

/**
 * 描述：
 * 1006. 笨阶乘
 * @author cwolf
 * @version 1.0
 * @date 2021/4/1 14:44
 */
public class Code1006 {

    public static int clumsy(int n) {
        int total = 0;
        for(int i=0;i<n;){
            int num = i==0?(n-i):-(n-i);
            i++;
            if(i<n){
                num = num*(n-i);
            }
            i++;
            if(i<n){
                num = num/(n-i);
            }
            i+=2;
            total+=num;

        }
        int s = n+1;
        int k = s/4;
        int ss =k*s-(k+1)*k*2;
        total+= ss;
        return total;





    }

    public static void main(String[] args) {
        System.out.println(Code1006.clumsy(10));
    }


}
